let timer = null;

//页面加载先执行一次

function judge() {
    let href = location.href
    let isPhone = /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)
    console.log(href);
    if (isPhone && href !== "http://localhost:9527/mobile.html#") {
        window.location.href = '/mobile.html#'
    } else if (!isPhone && href !== "http://localhost:9527/pc.html#") {
        window.location.href = '/pc.html#'
    }
}
judge()
window.onresize = function () {
    console.log(navigator.userAgent);
    if (timer) {
        clearTimeout(timer)
    }
    timer = setTimeout(judge, 100) //防抖
}